package com.motherchild.common;

import lombok.Data;

@Data
public class ResponseResult<T> {
    private boolean success; // 是否成功
    private String errorCode; // 错误代码
    private String errorMessage; // 错误信息
    private T data; // 数据

    public ResponseResult(boolean success, String errorCode, String errorMessage, T data) {
        this.success = success;
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.data = data;
    }

    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult<>(true, null, null, data);
    }

    public static <T> ResponseResult<T> failure(String errorCode, String errorMessage) {
        return new ResponseResult<>(false, errorCode, errorMessage, null);
    }
} 